<!--胡晨倩、沈姚楠  -->
<%@page import="java.util.List"%>
<%@page import="java.util.List"%>
<%@page import="com.xz.group12306.business.service.impl.TicketServiceImpl"%>
<%@page import="com.xz.group12306.business.service.TicketService"%>
<%@page import="com.xz.group12306.domain.Ticket"%>
<%@page import="com.xz.group12306.domain.Ticket"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

     <%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Insert title here</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        
   <!--  <link rel="stylesheet" type="text/css" href="../js/util/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../js/util/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../js/util/easyui/demo.css">
    <script type="text/javascript" src="../js/util/easyui/jquery.min.js"></script>-->
    <script type="text/javascript" src="../js/util/easyui/jquery.easyui.min.js"></script> 

</head>
<body> 
<form>
  <table class="easyui-datagrid" title="Basic DataGrid" style="width:700px;height:250px"
            data-options="singleSelect:true,collapsible:true,url:'datagrid_data1.json',method:'get'">
         
        <thead>
            <tr>
                <th data-options="field:'ticketid',width:80">车票ID</th>
                <th data-options="field:'depature',width:80">始发地</th>
                <th data-options="field:'distinction',width:80">目的地</th>
                <th data-options="field:'trainno',width:80">车次</th>
                <th data-options="field:'starttime',width:150">开车时间</th>
                <th data-options="field:'seatno',width:60">座位号</th>
                <th data-options="field:'costtime',width:150">花费时间</th>
                <th data-options="field:'ticketno',width:150">余票</th>
                <th data-options="field:'choose',width:150">选择</th>
            </tr>
              
        
        </thead>
        <% 
        int pageSize=Integer.parseInt(request.getParameter("pageSize"));
        int start=Integer.parseInt(request.getParameter("start"));


        String depature=request.getParameter("depature");
        String destinction=request.getParameter("destinction");
        Ticket ticket=new Ticket();
     	ticket.setDepature(depature);
     	ticket.setDestinction(destinction);

     	TicketService ticketService=new TicketServiceImpl();
     	List<Ticket> tickets=ticketService.findTicketList(ticket, start, pageSize);
     	request.setAttribute("ticketss", tickets);
%>
        
         <%--     <%
               for(Ticket ticket2:tickets){          	                  
            %>  --%>
        <tbody>
        <c:forEach items="${ticketss }" var="ticket">
            <tr>
             <td>${ticket.ticketId }</td>
               <td>${ticket.depature }</td>
                <td>${ticket.destinction }</td>
                 <td>${ticket.trainNo }</td>
                  <td>${ticket.startTime}</td>
                  <td>${ticket.seatNo}</td>
                  <td>${ticket.costTime}</td>
                   <td>${ticket.ticketNo}</td>
                    <td>
						<a href="javascript:void(0)" class="easyui-linkbutton"
							data-options="plain:true"
							onclick="addTab('../OneTicketServlet?TicketId=${ticket.ticketId }')">购买</a>
					
				</td>
            
            </tr>
            </c:forEach>
            </tbody>
           
            
   
    </table>
    
    
  <!-- <a href="../user/index.jsp" class="easyui-linkbutton" data-options="iconCls:'icon-remove'">返回</a></div>  -->
  </form>
   <script type="text/javascript">
		function addTab(url) {
			var content = '<iframe scrolling="auto" frameborder="0"  src="'
					+ url + '" style="width:100%;height:100%;"></iframe>';
			$('#tt').tabs('add', {
				title : '购票中心',
				content : content,
				closable : true
			});
		}
		
		/* function closeTab(){ 
			parent.$('#tt').tabs('close','购票中心');
			   
		   } */
	</script>
</body>
</html>